<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title></title>
<script src="../js/easyui-1.3.5/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/ajax.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var rootName = ajax.getRootName();
$(function() {
  $("input[name=send]").click(function() {
    var ip = $("input[name=ip]").val();
    var user = $("input[name=user]").val();
    var pswd = $("input[name=pswd]").val();
    var url = rootName + "/api/koala/login?ip=" + ip + "&user=" + user + "&pswd=" + pswd;
    $.get(url, {}, function(data) {
      alert(data);
    })
  });
});
window.onload = function() {
  var action = rootName + '/api/koala/photo';
  document.getElementById('upload').action = action;

  var url = rootName + '/koala_host/list';
  $.get(url, {}, function(response) {
    //response={"total":1,"rows":[{"id":3,"ip":"10.110.118.127","masterIp":"10.110.118.127","password":"admin123456","username":"admin@123456.com"}]};
    var koalaBaseUrl = document.getElementsByName("koalaBaseUrl")[0];
    var username=document.getElementsByName("username")[0];
    var password=document.getElementsByName("password")[0];
    var rows = response.rows;
    for(var i = 0; i < rows.length; i++) {
      var address='http://'+rows[i].masterIp
      koalaBaseUrl.add(new Option(address,address),undefined);
      username.add(new Option(rows[i].username,rows[i].username),undefined);
      password.add(new Option(rows[i].password,rows[i].password),undefined);
    }
  }, "json");

}
</script>
</head>

<body>
<label>koala login 测试:</label><br />
<label>koala_host_ip:</label><input type="text" name="ip" value="192.168.1.50">
<label>user:</label><input type="text" name="user" value="litongjava@qq.com">
<label> pswd:</label><input type="text" name="pswd" value="00000000">
<input type="button" name="send" value="发送"><br />

<br />
<label>koala上传图片测试</label><br />
<form method="post" id="upload" enctype="multipart/form-data">
  <label>koalaBaseUrl:</label> <select name="koalaBaseUrl" id=""></select>
  <label>username:</label> <select name="username" id=""></select>
  <label>password:</label> <select name="password" id=""></select>
  <br />
  <label>photo:</label> <input type="file" name="photo" />
  <input type="submit" />
</form>

</body>

</html>